<template>
	<view>
		<view>
			
		</view>

		<view class="rectangle" >
			<view>
				<u-avatar :src="src" style="margin-left: 34rpx; margin-top: 30rpx;"></u-avatar>
			</view>
			<view>
				<view style="margin-left: 20%;margin-top: -10%;font-family: 'segoe UI Black';font-size: 35rpx;" class="name">{{staffName}}</view>
			</view>
		</view>

		<view>
			<u-cell-group v-for="(item,i) in Derpartment">
				<u-cell-item :arrow="false" :title="item.departMentName" :value="item.time"></u-cell-item>
			</u-cell-group>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				staffName:"",
				src: '../../../static/homepage/boyPortrait.png',
				Derpartment:[],
				date:"",
				interfaceId:'',
				//姓名
				//日期
				//部门
					//经理的名字
					//班的时间
			}
		},
		methods: {
			toLogin(){
				uni.navigateTo({
					url:"../Roster"
				})
				fail: (res) => {
				                    console.log(res)//打印错误信息
				                }
			},
			getInterFace:function(){
				return new Promise((resolve,reject)=>{
					const _this = this;
					console.log(_this.interfaceId)
					uni.request({
						url:"http://47.99.124.245:8008/arrange/screen",
						method:'POST',
						data:{number:_this.interfaceId['id'],departmentid:0,managernumber:0,date:_this.interfaceId['time']},
						header:{
							'content-type': 'application/x-www-form-urlencoded'
						},
						success(res){
							resolve(res)
							console.log(res.data)
							var da=res.data.data[_this.interfaceId['weekindex']]
							_this.staffName=da.arrangeList[0].staffname
							_this.date=da.arrangeList[0].date
							var i=0;
							var eact={}
							for(i=0;i<da.arrangeList.length;i++){
								eact={}
								eact['departMentName']=da.arrangeList[i].departmentname
								eact['time']=da.arrangeList[i].startTime+'-'+da.arrangeList[i].finishTime
								_this.Derpartment.push(eact)
							}
							console.log(_this.Derpartment)
						},
						fail: (err) => {
							uni.showToast({
								title:"请求接口失败",
								icon:"none"
							})
							reject(err)
						}
					})
				})
			}
		},
		onLoad(e){
			if(e.addr){
				this.interfaceId=JSON.parse(e.addr)
				//接接口
				console.log(this.interfaceId)
				this.getInterFace()
			}
		}
	}
</script>

<style>
.rectangle {
  width: 100%;
  height: 158rpx;
  padding: 4rpx 4rpx 4rpx 4rpx;
  border: 3rpx solid rgba(215, 215, 215, 0.54);
  background-color: #ffffff;
  box-sizing: border-box;
  margin-top: 50rpx;
}

.rectangle1 {
  width: 100%;
  height: 302rpx;
  padding: 4rpx 4rpx 4rpx 4rpx;
  border: 3rpx solid rgba(215, 215, 215, 0.54);
  background-color: #ffffff;
  box-sizing: border-box;
  margin-top: 30rpx;

}

page{
	background-color: rgba(242, 242, 242, 0.5);
	/* opacity: 0.5; */
}
.name{
	margin-top: 120rpx;
}
</style>
<style scoped>
/deep/ .u-avatar__img{
	/* margin-left: 30rpx; */
}
</style>
